//
//  TNTeamForm.m
//  跑跑快销
//
//  Created by ylife on 14-5-7.
//  Copyright (c) 2014年 ylife. All rights reserved.
//
#define DateButtonHeight 60
#define TitleWidth 320 / 4
#define LableHeight 50

#import "TNTeamForm.h"
#import "TNTeamFormCell.h"
@implementation TNTeamForm

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        [self createTableView];
        [self createDateView];
        [self createTitleView];
        [self createLable];
    }
    return self;
}

- (void)createDateView
{
    _myDateButton = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 320, DateButtonHeight)];
    [self addSubview:_myDateButton];
}

- (void)createTitleView
{
    UILabel *lable1 = [[UILabel alloc]initWithFrame:CGRectMake(0, DateButtonHeight, TitleWidth, 60)];
    lable1.text = @"成员";
    lable1.textAlignment = NSTextAlignmentCenter;
    lable1.layer.borderWidth = 0.25;
    lable1.layer.borderColor = [UIColor blackColor].CGColor;
    [self addSubview:lable1];
    
    UILabel *lable2 = [[UILabel alloc]initWithFrame:CGRectMake(TitleWidth , DateButtonHeight, TitleWidth, 60)];
    lable2.text = @"金额(元)";
    lable2.textAlignment = NSTextAlignmentCenter;
    lable2.layer.borderWidth = 0.25;
    lable2.layer.borderColor = [UIColor blackColor].CGColor;
    [self addSubview:lable2];
    
    UILabel *lable3 = [[UILabel alloc]initWithFrame:CGRectMake(TitleWidth * 2, DateButtonHeight, TitleWidth, 60)];
    lable3.text = @"目标量(元)";
    lable3.textAlignment = NSTextAlignmentCenter;
    lable3.layer.borderWidth = 0.25;
    lable3.layer.borderColor = [UIColor blackColor].CGColor;
    [self addSubview:lable3];
    
    UILabel *lable4 = [[UILabel alloc]initWithFrame:CGRectMake(TitleWidth * 3, DateButtonHeight, TitleWidth, 60)];
    lable4.text = @"达成率(%)";
    lable4.textAlignment = NSTextAlignmentCenter;
    lable4.layer.borderWidth = 0.25;
    lable4.layer.borderColor = [UIColor blackColor].CGColor;
    [self addSubview:lable4];
}

- (void)createTableView
{
    _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, DateButtonHeight + 60, 320, PHONESIZEHEIGHT - STARTY - DateButtonHeight - LableHeight - 60  )];
    NSLog(@"%f",self.frame.size.height);
    [_tableView registerClass:[TNTeamFormCell class] forCellReuseIdentifier:@"TNTeamFormCell"];
    [_tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
    [_tableView setBounces:NO];
    [self addSubview:_tableView];
}

- (void)createLable
{
    UILabel *lable1 = [[UILabel alloc]initWithFrame:CGRectMake(0, PHONESIZEHEIGHT - STARTY - LableHeight, TitleWidth, LableHeight)];
    lable1.text = @"总金额(元)";
    lable1.textAlignment = NSTextAlignmentCenter;
    lable1.layer.borderWidth = 0.25;
    lable1.layer.borderColor = [UIColor blackColor].CGColor;
    [self addSubview:lable1];
    
    _totalMoneyLab = [[UILabel alloc]initWithFrame:CGRectMake(TitleWidth , PHONESIZEHEIGHT - STARTY - LableHeight, TitleWidth, LableHeight)];
    _totalMoneyLab.textAlignment = NSTextAlignmentCenter;
    _totalMoneyLab.layer.borderWidth = 0.25;
    _totalMoneyLab.layer.borderColor = [UIColor blackColor].CGColor;
    [self addSubview:_totalMoneyLab];
    
    UILabel *lable3 = [[UILabel alloc]initWithFrame:CGRectMake(TitleWidth * 2, PHONESIZEHEIGHT - STARTY -  LableHeight, TitleWidth, LableHeight)];
    lable3.text = @"日达成(%)";
    lable3.textAlignment = NSTextAlignmentCenter;
    lable3.layer.borderWidth = 0.25;
    lable3.layer.borderColor = [UIColor blackColor].CGColor;
    [self addSubview:lable3];
    
    _dayPercent = [[UILabel alloc]initWithFrame:CGRectMake(TitleWidth * 3, PHONESIZEHEIGHT - STARTY - LableHeight, TitleWidth, LableHeight)];
    _dayPercent.textAlignment = NSTextAlignmentCenter;
    _dayPercent.layer.borderWidth = 0.25;
    _dayPercent.layer.borderColor = [UIColor blackColor].CGColor;
    [self addSubview:_dayPercent];
}

@end
